//
//  HWChangePasswordViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/30.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWChangePasswordViewController.h"
#import "HWGuanlianPhoneTableViewCell.h"
#import "Countdown.h"

@interface HWChangePasswordViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) UIView *lowerPartView;
@end

@implementation HWChangePasswordViewController

-(UITableView *)mainaTableVie {

    if  (_mainaTableVie == nil) {

        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, CF_NavHeight+88) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
       // _mainaTableVie.backgroundColor = RGB(241, 242, 244);
        
    }
    return   _mainaTableVie ;

}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupUI];
    
    
}


//设置UI
-(void)setupUI {
    self.navigationItem.title = @"修改密码";
    self.view.backgroundColor = [UIColor whiteColor];
   // self.view.backgroundColor = [UIColor redColor];
    [self.view addSubview:self.mainaTableVie];
    
    [self addLowerPartView];

}





// 添加低部UIview
- (void)addLowerPartView {
    
    self.lowerPartView = [[UIView alloc]initWithFrame:CGRectMake(0, CF_NavHeight+88+30, kScreenW, 44)];
    // self.lowerPartView.backgroundColor = [UIColor yellowColor];
    self.lowerPartView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.lowerPartView];
    
    UIButton *butt  = [UIButton setButtonWithFrame:CGRectMake(15, 0, kScreenW-15*2, 36) Title:@"确定" Image:nil Font:13 Color:RGB(255, 255, 155) Target:self Selector:@selector(buttonTap)];
    butt.backgroundColor = blueBackgroundBT;
    butt.layer.cornerRadius = 18;
    butt.layer.masksToBounds = YES;
    [self.lowerPartView addSubview:butt];
    
}

- (void)buttonTap {
    
    NSLog(@"保存");
//    HWbangdingQQViewController *bangding = [[HWbangdingQQViewController alloc]init];
//    [self.navigationController pushViewController:bangding animated:YES];
    
    
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 2;
    
    
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  {
    
    static NSString *cellID = @"cellID";
    
    HWGuanlianPhoneTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (!cell) {
        cell = [[HWGuanlianPhoneTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
        
    }
    
    if (indexPath.row == 0) {
        
        cell.namelabel.text = @"新密码";
        cell.codeBut.hidden = YES;
        
       NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:@"6-15个字符，区分大小写" attributes:
                   @{NSForegroundColorAttributeName:RGB(153, 153, 153),
                     NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}
                   ];
      cell.titleTextField.attributedPlaceholder  = attrString;
        
    } else if (indexPath.row == 1) {
        
         cell.namelabel.text = @"确认密码";
         cell.codeBut.hidden = NO;
         NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc] initWithString:@"请再次输入密码" attributes:
                         @{NSForegroundColorAttributeName:RGB(153, 153, 153),
                           NSFontAttributeName:[UIFont boldSystemFontOfSize:12]}
                         ];
         cell.titleTextField.attributedPlaceholder  = attrString;
        
        
    }
    
    [cell.codeBut addTarget:self action:@selector(xianshyanjTap:) forControlEvents:UIControlEventTouchUpInside];

    return  cell;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    return  44;
    
}



// 获取验证码
- (void)xianshyanjTap:(UIButton *)sende {
    
//    if (![WMUtil validateMobile:self.titleTextField.text]) {
//
//        [MBProgressHUD showError:@"请输入正确的手机号"];
//        return ;
//
//
//    }
//

    
    [Countdown  StartTimeCodeBtn:sende];
    
    
    
   
    
    
    
    DLog(@"获取验证码");
    

    
}

@end
